package com.iknow.xmpp.service;

import android.net.Uri;
import android.os.RemoteException;
import com.iknow.xmpp.service.aidl.IChatManager;
import com.iknow.xmpp.service.aidl.IPrivacyListManager;
import com.iknow.xmpp.service.aidl.IRoster;
import com.iknow.xmpp.service.aidl.IXmppConnection;
import com.iknow.xmpp.service.aidl.IXmppFacade.Stub;
import com.iknow.xmpp.util.PresenceType;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;

public class XmppFacade extends IXmppFacade.Stub
{
  private final XmppConnectionAdapter mConnexion;

  public XmppFacade(XmppConnectionAdapter paramXmppConnectionAdapter)
  {
    this.mConnexion = paramXmppConnectionAdapter;
  }

  public void call(String paramString)
    throws RemoteException
  {
  }

  public void changeStatus(int paramInt, String paramString)
  {
    this.mConnexion.changeStatus(paramInt, paramString);
  }

  public void connectAsync()
    throws RemoteException
  {
    this.mConnexion.connectAsync();
  }

  public void connectSync()
    throws RemoteException
  {
    this.mConnexion.connectSync();
  }

  public IXmppConnection createConnection()
    throws RemoteException
  {
    return this.mConnexion;
  }

  public void disableAvatarPublishing()
    throws RemoteException
  {
    IKnowAvatarManager localIKnowAvatarManager = this.mConnexion.getAvatarManager();
    if (localIKnowAvatarManager != null)
      localIKnowAvatarManager.disableAvatarPublishing();
  }

  public void disconnect()
    throws RemoteException
  {
    this.mConnexion.disconnect();
  }

  public IChatManager getChatManager()
    throws RemoteException
  {
    return this.mConnexion.getChatManager();
  }

  public IPrivacyListManager getPrivacyListManager()
  {
    return this.mConnexion.getPrivacyListManager();
  }

  public IRoster getRoster()
    throws RemoteException
  {
    return this.mConnexion.getRoster();
  }

  public UserInfo getUserInfo()
    throws RemoteException
  {
    return this.mConnexion.getUserInfo();
  }

  public boolean publishAvatar(Uri paramUri)
    throws RemoteException
  {
    boolean bool;
    IKnowAvatarManager localIKnowAvatarManager = this.mConnexion.getAvatarManager();
    if (localIKnowAvatarManager == null)
      bool = false;
    while (true)
    {
      return bool;
      bool = localIKnowAvatarManager.publishAvatar(paramUri);
    }
  }

  public void sendPacket(Packet paramPacket)
  {
    this.mConnexion.getXMPPConnection().sendPacket(paramPacket);
  }

  public void sendPresencePacket(PresenceAdapter paramPresenceAdapter)
    throws RemoteException
  {
    Presence localPresence = new Presence(PresenceType.getPresenceTypeFrom(paramPresenceAdapter.getType()));
    localPresence.setTo(paramPresenceAdapter.getTo());
    this.mConnexion.getAdaptee().sendPacket(localPresence);
  }
}